package com.bort.system.utils;

import javafx.scene.image.Image;

import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;

public class ImageCache {
    private static final Map<String, Image> imageCache = new HashMap<>();

    public static Image getImage(String url) {
        return imageCache.computeIfAbsent(url, Image::new);
    }

    public static void setImage(String url, Image image) {
        imageCache.computeIfAbsent(url, (Function<? super String, ? extends Image>) image);
    }
}
